package com.campus_activity.campus_activity.handler.exception;

import com.campus_activity.campus_activity.common.R;
import com.campus_activity.campus_activity.constant.HttpStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author icyrain11
 * @version 1.8
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public R<?> runtimeExceptionHandler(RuntimeException e) {
        log.error("runtimeException", e);
        return R.fail(HttpStatus.ERROR, e.getMessage());
    }
}
